home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / coding / 80x86 / code32.lzh / HEXW2BCD.RT < prev    next >
Text File  |  1993-01-09  |  907b  |  45 lines

  1. public  _cvhexw2bcd
  2.  
  3. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  4. ; Convers hex AX to BCDpacked EAX
  5. ; In:
  6. ;   AX - hex num to convert
  7. ; Out:
  8. ;   EAX - BCDpacked number
  9. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  10. _cvhexw2bcd:
  11.         push bx
  12.         push ecx
  13.         push dx
  14.         xor ecx,ecx
  15.         xor dx,dx
  16.         mov bx,10000
  17.         div bx
  18.         or cl,al
  19.         shl ecx,4
  20.         mov ax,dx
  21.         xor dx,dx
  22.         mov bx,1000
  23.         div bx
  24.         or cl,al
  25.         shl ecx,4
  26.         mov ax,dx
  27.         xor dx,dx
  28.         mov bx,100
  29.         div bx
  30.         or cl,al
  31.         shl ecx,4
  32.         mov ax,dx
  33.         xor dx,dx
  34.         mov bx,10
  35.         div bx
  36.         or cl,al
  37.         shl ecx,4
  38.         or cl,dl
  39.         mov eax,ecx
  40.         pop dx
  41.         pop ecx
  42.         pop bx
  43.         ret
  44.  
  45.